package com.huawei.hwCloudJs.core.extKit;

import android.util.Log;
import java.util.HashMap;
import java.util.Map;

public class a {
    private static Map<String, Class<? extends IExtKit>> a = new HashMap();

    public static void a(String str, Class<? extends IExtKit> cls) {
        a.put(str, cls);
    }

    public static <U, R extends Class> U b(String str, R r) {
        try {
            IExtKit iExtKit = (IExtKit) ((Class) a.get(str)).newInstance();
            if (r.isInstance(iExtKit)) {
                return iExtKit;
            }
        } catch (InstantiationException e) {
            Log.e("ExtKitFactory", "InstantiationException");
        } catch (IllegalAccessException e2) {
            Log.e("ExtKitFactory", "IllegalAccessException");
        }
        return null;
    }
}
